From: Domas Mituzas Date: Thu, 9 Sep 2004 07:12:11 +0000 (+0000) Subject: add indexUnique() X-Git-Tag: 1.5.0alpha1~2046 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=378956d652058d4796293b5aaded6dfcebcea625;p=lhc%2Fweb%2Fwiklou.git add indexUnique() --- diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 75c7fe4808..736822fb73 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -171,6 +171,18 @@ class DatabasePgsql extends Database { return false; } + function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) { + $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'". + " AND indexdef LIKE 'CREATE UNIQUE%({$index})'"; + $res = $this->query( $sql, $fname ); + if ( !$res ) + return NULL; + while ($row = $this->fetchObject( $res )) + return true; + return false; + + } + function fieldInfo( $table, $field ) { wfDebugDieBacktrace( 'Database::fieldInfo() error : mysql_fetch_field() not implemented for postgre' ); /*